#include <stdio.h>
int main()
{
    int N;
    long num[1000] = {0};
    long count[10] = {0};
    long temp, number;
    int i;
    long max; //记录出现次数最多次的数据的数量
    scanf("%d", &N);
    for (i = 0; i < N; i++) //录入数字
        scanf("%d", &num[i]);
    for (i = 0; i < N; i++) //计算每位数字出现的个数
    {
        number = num[i];
        do
        {
            temp = number % 10;
            count[temp]++;
            number = number / 10;
        } while (number != 0);
    }
    max = count[0];
    for (i = 1; i < 10; i++)
    {
        if (max < count[i])
            max = count[i];
    }
    printf("%ld:", max);
    for (i = 0; i < 10; i++)
    {
        if (max == count[i])
            printf(" %d", i);
    }
    return 0;
}